//
//  YKDoctlistCell.m
//  HMPersonalDoctor
//
//  Created by 叶文凯 on 16/9/8.
//  Copyright © 2016年 geduo. All rights reserved.
//

#import "YKDoctlistCell.h"
#import "YKDoctorModel.h"


@interface YKDoctlistCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconImage;
@property (weak, nonatomic) IBOutlet UILabel *xingLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *numLabel;
@property (weak, nonatomic) IBOutlet UIButton *askButton;
@property (weak, nonatomic) IBOutlet UIButton *requireButton;


@end

@implementation YKDoctlistCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.iconImage.layer.cornerRadius = 20;
    self.iconImage.layer.masksToBounds = YES;
    self.askButton.tag = 1;
    self.requireButton.tag = 2;
    
}
- (IBAction)askClick:(id)sender {
    
    UIImage *img = [UIImage imageNamed:self.model.icon];
    
    if ([self.delegate respondsToSelector:@selector(askQuestion:)]) {
        
        [self.delegate askQuestion:(img)];
        
    }
    
    
    
}
- (IBAction)requireClick:(id)sender {
    
    
    if ([self.delegate respondsToSelector:@selector(requireOtherHospital:)]) {
        
        [self.delegate requireOtherHospital:sender];
    }
    
    
}

- (void)setModel:(YKDoctorModel *)model
{
    
    _model = model;
    
    self.nameLabel.text = [NSString stringWithFormat:@"%@ %@",model.title,model.name];
    self.xingLabel.text = model.xing;
    self.iconImage.image = [UIImage imageNamed: model.icon];
 
    self.numLabel.text = [NSString stringWithFormat:@"%zd",model.num];
}


@end
